----------------------------------------------------------------------------------------------------------------
      name:  <unnamed>
       log:  -
  log type:  text
 opened on:  19 Aug 2021, 00:39:40


. *Code verified using Stata/SE 16.1.
. 
. //TABLE OF CONTENTS.
. //0.0. Packages.
. //1.0. Article.
. //1.1. Some preparation.
. //1.2. Descriptive Statistics.
. //1.3. Regression Models.
. 
. 
. //0.0. PACKAGES.
. 
. *We use "blindschemes" for all graphs, "covbal" for the balance statistics, and "xtabond2" for the dynamic GMM
>  models. These packages can be downloaded via the Stata console:
. 
. ssc install blindschemes
checking blindschemes consistency and verifying not already installed...
all files already exist and are up to date.

. ssc install covbal
checking covbal consistency and verifying not already installed...
all files already exist and are up to date.

. ssc install xtabond2
checking xtabond2 consistency and verifying not already installed...
all files already exist and are up to date.

. 
. 
. //1.0. ARTICLE.
. 
. *Load dataset. Below code should be performed in order.
. 
. 
. //1.1. SOME PREPARATION.
. 
. *Sort data and xtset
. sort agency_id year

. xtset agency_id year
       panel variable:  agency_id (unbalanced)
        time variable:  year, 1971 to 2014, but with gaps
                delta:  1 unit

. 
. *Generate inflation-adjusted budget.
. gen i_budget=budget*inflation

. 
. *Generate log budget.
. gen lni_budget=ln(i_budget)
(6 missing values generated)

. 
. *Generate budget growth.
. bys agency_id: gen bgrowth = (D.i_budget/L.i_budget)
(500 missing values generated)

. replace bgrowth=bgrowth*100
(6,555 real changes made)

. 
. *Generate bootstrap identifier.
. gen bs_agency_id=agency_id

. 
. *Use Hadi's ancient method to identify outliers.
. hadimvo bgrowth, gen(odd)

Beginning number of observations:          6555
              Initially accepted:             2
             Expand to (n+k+1)/2:          3278
                Expand,  p = .05:          6294
              Outliers remaining:           261

. 
. 
. //1.2. DESCRIPTIVE STATISTICS.
. 
. //Figure 1. Budget Growth by Year.
. 
. *Generate median growth per year.
. by year, sort: egen mgrowth = median(bgrowth)
(110 missing values generated)

. 
. *Graph growth separated by government incumbent.
. twoway (scatter bgrowth year if bgrowth>-100 & bgrowth<100 & incumbent==0, mcolor(gs12) msize(vsmall)) (scatte
> r bgrowth year if bgrowth>-100 & bgrowth<100 & incumbent==1, mcolor(gs8) msymbol(triangle_hollow) msize(vsmall
> )) (line mgrowth year, lpattern(solid) lwidth(thin) lcolor(black)), scheme(plotplain) xtitle("Fiscal Year") yt
> itle("Budget Growth (%)", margin(0 0 0 0)) xtick(1970 (10) 2015) title("") legend(position(6) region(lcolor(no
> ne)) bmargin(zero) region(margin(zero)) rows(1) cols(2) order(1 "Social Democratic Gov't" 2 "Liberal-Conservat
> ive Gov't")) aspect(1) xsize(5) ysize(5) graphregion(m(l=0))

. 
. 
. //Figure 2. Conflict Distribution by Year.
. 
. *Generate mean conflict per year.
. by year, sort: egen conflict_tot=mean(conflict) if bgrowth~=.
(500 missing values generated)

. 
. *Graph conflict separated by government incumbent.
. graph twoway (bar conflict_tot year if incumbent==0, lwidth(0) barw(0.9) fcolor(gs12)) (bar conflict_tot year 
> if incumbent==1, lwidth(0) barw(0.9) fcolor(gs8)), scheme(plotplain) ylabel(0 (0.25) 1) xtitle(Fiscal Year) yt
> itle(Conflict Distribution, margin(0 0 0 0)) title("") ylabel(, format(%9.2fc)) xlabel(1970 (10) 2015) legend(
> position(6) region(lcolor(none)) bmargin(zero) region(margin(zero)) order(1 "Social Democratic Gov't" 2 "Liber
> al-Conservative Gov't") symxsize(2) rows(1) cols(2)) aspect(1) xsize(5) ysize(5) graphregion(m(l=0))

. 
. 
. //1.3. REGRESSION MODELS.
. 
. *Sort data and xtset.
. sort agency_id year

. xtset agency_id year
       panel variable:  agency_id (unbalanced)
        time variable:  year, 1971 to 2014, but with gaps
                delta:  1 unit

. 
. *Note that we recode the outliers as missing values instead of restricting the estimation sample in the models
> . This is mainly to avoid some annoyances with the GMM functions in Model 3, which will otherwise incorporate 
> information from the outlying values.
. replace bgrowth=. if odd==1
(261 real changes made, 261 to missing)

. 
. *We also change the decimal format to avoid being burdened with unneccesary details.
. set cformat %3.2f

. 
. 
. //Table 1. Ideological Conflict and Agency Budget Growth in Sweden, 1971-2014.
. 
. *Model 1.
. bootstrap, cluster(agency_id) idcluster(bs_agency_id) group(agency_id) seed(999) reps(1000): xtreg bgrowth i.c
> onflict i.academic i.political i.private i.public i.council i.board i.creator cl.lni_budget i.year, fe
(running xtreg on estimation sample)

Bootstrap replications (1000)
----+--- 1 ---+--- 2 ---+--- 3 ---+--- 4 ---+--- 5 
..................................................    50
..................................................   100
..................................................   150
..................................................   200
..................................................   250
..................................................   300
..................................................   350
..................................................   400
..................................................   450
..................................................   500
..................................................   550
..................................................   600
..................................................   650
..................................................   700
..................................................   750
..................................................   800
..................................................   850
..................................................   900
..................................................   950
..................................................  1000

Fixed-effects (within) regression               Number of obs     =      5,316
Group variable: agency_id                       Number of groups  =        371

R-sq:                                           Obs per group:
     within  = 0.2635                                         min =          1
     between = 0.0093                                         avg =       14.3
     overall = 0.1921                                         max =         43

                                                Wald chi2(51)     =    1901.07
corr(u_i, Xb)  = -0.2265                        Prob > chi2       =     0.0000

                             (Replications based on 371 clusters in agency_id)
------------------------------------------------------------------------------
             |   Observed   Bootstrap                         Normal-based
     bgrowth |      Coef.   Std. Err.      z    P>|z|     [95% Conf. Interval]
-------------+----------------------------------------------------------------
  1.conflict |      -1.79       0.58    -3.06   0.002        -2.93       -0.64
  1.academic |      -1.22       0.94    -1.31   0.192        -3.06        0.61
 1.political |      -0.71       0.69    -1.02   0.310        -2.07        0.66
   1.private |       0.66       0.94     0.70   0.483        -1.18        2.50
    1.public |       0.83       0.65     1.28   0.202        -0.45        2.11
   1.council |       0.38       0.90     0.42   0.672        -1.39        2.15
     1.board |      -2.05       0.92    -2.23   0.026        -3.86       -0.25
   1.creator |      -0.12       0.50    -0.24   0.810        -1.10        0.86
             |
  lni_budget |
         L1. |      -0.79       0.61    -1.29   0.196        -1.99        0.41
             |
        year |
       1973  |      12.15       2.26     5.38   0.000         7.73       16.57
       1974  |      -1.62       1.97    -0.82   0.411        -5.48        2.24
       1975  |      -2.06       1.83    -1.13   0.260        -5.64        1.52
       1976  |       0.26       2.61     0.10   0.920        -4.85        5.37
       1977  |       8.70       2.42     3.59   0.000         3.96       13.45
       1978  |       2.37       2.32     1.02   0.307        -2.18        6.93
       1979  |       5.41       2.12     2.56   0.011         1.26        9.56
       1980  |      -4.31       2.11    -2.05   0.040        -8.44       -0.19
       1981  |       1.76       2.48     0.71   0.476        -3.09        6.62
       1982  |      -4.03       1.91    -2.12   0.034        -7.77       -0.30
       1983  |      -4.16       2.13    -1.95   0.051        -8.34        0.02
       1984  |      -3.65       1.91    -1.91   0.056        -7.39        0.09
       1985  |      -5.19       1.88    -2.76   0.006        -8.87       -1.50
       1986  |      -0.79       2.03    -0.39   0.698        -4.78        3.20
       1987  |      -0.17       2.19    -0.08   0.939        -4.46        4.12
       1988  |      -4.23       2.33    -1.82   0.069        -8.79        0.34
       1989  |      -1.09       2.35    -0.47   0.642        -5.69        3.51
       1990  |      -1.19       2.26    -0.53   0.597        -5.62        3.23
       1991  |      -6.09       2.22    -2.75   0.006       -10.43       -1.75
       1992  |       5.90       2.33     2.53   0.011         1.32       10.47
       1993  |      -5.24       2.45    -2.14   0.032       -10.03       -0.44
       1994  |       0.37       2.45     0.15   0.879        -4.43        5.17
       1995  |       9.88       2.36     4.18   0.000         5.24       14.51
       1996  |      39.41       2.70    14.58   0.000        34.11       44.71
       1997  |     -29.01       2.50   -11.63   0.000       -33.90      -24.11
       1998  |      -4.02       2.33    -1.72   0.085        -8.59        0.55
       1999  |      -0.27       2.25    -0.12   0.904        -4.68        4.13
       2000  |      -5.31       2.23    -2.39   0.017        -9.67       -0.95
       2001  |      -1.51       2.34    -0.65   0.518        -6.08        3.07
       2002  |      -1.90       2.12    -0.90   0.369        -6.05        2.25
       2003  |      -3.29       2.17    -1.52   0.129        -7.54        0.96
       2004  |      -3.15       2.06    -1.53   0.125        -7.18        0.88
       2005  |      -3.06       2.11    -1.45   0.147        -7.19        1.07
       2006  |      -2.63       2.12    -1.24   0.215        -6.79        1.53
       2007  |      -2.20       2.18    -1.01   0.313        -6.47        2.07
       2008  |      -8.66       2.26    -3.83   0.000       -13.10       -4.23
       2009  |      -4.32       2.47    -1.75   0.080        -9.15        0.51
       2010  |      -2.33       2.29    -1.02   0.309        -6.81        2.16
       2011  |      -7.03       2.33    -3.02   0.003       -11.60       -2.46
       2012  |      -3.96       2.24    -1.77   0.077        -8.36        0.43
       2013  |      -5.16       2.12    -2.43   0.015        -9.32       -1.00
       2014  |      -4.41       2.13    -2.07   0.038        -8.58       -0.24
             |
       _cons |      20.55      10.74     1.91   0.056        -0.50       41.60
-------------+----------------------------------------------------------------
     sigma_u |  8.5941833
     sigma_e |  14.778085
         rho |  .25272724   (fraction of variance due to u_i)
------------------------------------------------------------------------------

. 
. *Generate marginal predictions.
. margins conflict

Predictive margins                              Number of obs     =      5,316
Model VCE    : Bootstrap

Expression   : Linear prediction, predict()

------------------------------------------------------------------------------
             |            Delta-method
             |     Margin   Std. Err.      z    P>|z|     [95% Conf. Interval]
-------------+----------------------------------------------------------------
    conflict |
          0  |       3.64       0.43     8.39   0.000         2.79        4.49
          1  |       1.85       0.51     3.60   0.000         0.84        2.85
------------------------------------------------------------------------------

. 
. *Save marginal predictions for later use.
. marginsplot, name(m1,replace) scheme(plotplain) plotopts(lcolor(black) lwidth(thin) mcolor(black) mlwidth(thin
> )) ciopts(lcolor(black) lwidth(medthin)) title("Model 1", size(medsmall) nospan) ylabel(0(1)5) yline(0 5, lpat
> tern(dot) lwidth(thin) lcolor(gs10)) ytitle("Budget Growth (%)") xtitle("Ideological Conflict (0,1)") graphreg
> ion(m(l=0)) plotregion(m(l=0 r=0)) xscale(ra(-0.15 1.15))

  Variables that uniquely identify margins: conflict

. 
. *Model 2 (somewhat slow). 
. bootstrap, cluster(agency_id) idcluster(bs_agency_id) group(agency_id) seed(999) reps(1000): mixed bgrowth i.c
> onflict i.academic i.political i.private i.public i.council i.board i.creator cl.lni_budget i.year || agency_i
> d: conflict, reml cov(un) iterate(100)
(running mixed on estimation sample)

Bootstrap replications (1000)
----+--- 1 ---+--- 2 ---+--- 3 ---+--- 4 ---+--- 5 
..................................................    50
..................................................   100
..................................................   150
..................................................   200
..................................................   250
......x...........................................   300
..................................................   350
..................................................   400
..................................................   450
..................................................   500
..................................................   550
..................................................   600
.............................x....................   650
..................................................   700
..................................................   750
..................................................   800
..................................................   850
..................................................   900
...........................x....................x.   950
..................................................  1000

Mixed-effects REML regression                   Number of obs     =      5,316
Group variable: agency_id                       Number of groups  =        371

                                                Obs per group:
                                                              min =          1
                                                              avg =       14.3
                                                              max =         43

                                                Wald chi2(51)     =    1714.67
Log restricted-likelihood = -21908.385          Prob > chi2       =     0.0000

                             (Replications based on 371 clusters in agency_id)
------------------------------------------------------------------------------
             |   Observed   Bootstrap                         Normal-based
     bgrowth |      Coef.   Std. Err.      z    P>|z|     [95% Conf. Interval]
-------------+----------------------------------------------------------------
  1.conflict |      -1.96       0.53    -3.67   0.000        -3.01       -0.91
  1.academic |       1.38       0.60     2.29   0.022         0.20        2.57
 1.political |      -0.20       0.53    -0.38   0.704        -1.24        0.84
   1.private |       0.38       0.86     0.44   0.657        -1.31        2.08
    1.public |      -0.34       0.53    -0.64   0.523        -1.38        0.70
   1.council |      -0.64       0.50    -1.27   0.204        -1.62        0.35
     1.board |      -1.01       0.57    -1.77   0.076        -2.12        0.11
   1.creator |       0.31       0.51     0.60   0.547        -0.69        1.30
             |
  lni_budget |
         L1. |       0.22       0.18     1.18   0.239        -0.14        0.57
             |
        year |
       1973  |      12.37       2.26     5.47   0.000         7.94       16.80
       1974  |      -0.86       1.98    -0.43   0.666        -4.74        3.03
       1975  |      -0.88       1.78    -0.50   0.621        -4.37        2.61
       1976  |       1.42       2.60     0.55   0.584        -3.67        6.51
       1977  |       9.37       2.35     3.99   0.000         4.76       13.98
       1978  |       3.08       2.28     1.35   0.176        -1.38        7.55
       1979  |       5.87       2.09     2.82   0.005         1.78        9.96
       1980  |      -3.91       2.05    -1.91   0.056        -7.92        0.10
       1981  |       2.53       2.43     1.04   0.297        -2.23        7.30
       1982  |      -3.00       1.87    -1.60   0.109        -6.66        0.67
       1983  |      -3.28       2.11    -1.55   0.121        -7.42        0.86
       1984  |      -2.34       1.85    -1.26   0.206        -5.97        1.29
       1985  |      -3.68       1.82    -2.02   0.043        -7.23       -0.12
       1986  |       0.47       1.92     0.24   0.807        -3.29        4.23
       1987  |       1.10       2.11     0.52   0.601        -3.03        5.23
       1988  |      -2.54       2.20    -1.16   0.248        -6.84        1.76
       1989  |       1.18       2.25     0.52   0.600        -3.22        5.58
       1990  |       0.96       2.12     0.45   0.650        -3.19        5.11
       1991  |      -4.21       2.20    -1.91   0.056        -8.53        0.10
       1992  |       9.39       2.41     3.90   0.000         4.67       14.11
       1993  |      -2.18       2.33    -0.93   0.350        -6.75        2.39
       1994  |       3.22       2.37     1.36   0.174        -1.42        7.87
       1995  |      12.43       2.37     5.24   0.000         7.78       17.08
       1996  |      42.30       2.49    16.98   0.000        37.42       47.19
       1997  |     -26.19       2.26   -11.61   0.000       -30.62      -21.77
       1998  |      -0.86       2.16    -0.40   0.691        -5.10        3.38
       1999  |       2.86       2.06     1.39   0.164        -1.17        6.89
       2000  |      -2.21       2.04    -1.08   0.279        -6.20        1.79
       2001  |       1.56       2.13     0.73   0.462        -2.61        5.74
       2002  |       1.30       1.89     0.69   0.491        -2.40        5.01
       2003  |      -0.19       1.95    -0.10   0.923        -4.02        3.64
       2004  |       0.02       1.75     0.01   0.992        -3.42        3.45
       2005  |       0.37       1.80     0.21   0.837        -3.15        3.89
       2006  |       1.07       1.77     0.60   0.546        -2.41        4.55
       2007  |       1.51       1.85     0.82   0.415        -2.12        5.13
       2008  |      -4.09       2.03    -2.02   0.044        -8.06       -0.11
       2009  |       0.43       2.20     0.19   0.847        -3.89        4.74
       2010  |       2.44       2.05     1.19   0.236        -1.59        6.46
       2011  |      -2.37       2.04    -1.17   0.243        -6.37        1.62
       2012  |       0.56       1.90     0.29   0.769        -3.16        4.28
       2013  |      -0.66       1.79    -0.37   0.711        -4.17        2.85
       2014  |       0.15       1.72     0.08   0.932        -3.23        3.52
             |
       _cons |      -0.94       3.45    -0.27   0.785        -7.69        5.81
------------------------------------------------------------------------------

------------------------------------------------------------------------------
                             |   Observed   Bootstrap         Normal-based
  Random-effects Parameters  |   Estimate   Std. Err.     [95% Conf. Interval]
-----------------------------+------------------------------------------------
agency_id: Unstructured      |
               var(conflict) |       0.26       0.58          0.00       22.31
                  var(_cons) |       7.62       4.09          2.67       21.80
         cov(conflict,_cons) |       1.40       1.57         -1.68        4.47
-----------------------------+------------------------------------------------
               var(Residual) |     222.80      12.08        200.34      247.79
------------------------------------------------------------------------------
LR test vs. linear model: chi2(3) = 28.18                 Prob > chi2 = 0.0000

Note: LR test is conservative and provided only for reference.

. estat sd

------------------------------------------------------------------------------
                             |   Observed   Bootstrap         Normal-based
  Random-effects Parameters  |   Estimate   Std. Err.     [95% Conf. Interval]
-----------------------------+------------------------------------------------
agency_id: Unstructured      |
                sd(conflict) |       0.51       0.58          0.05        4.72
                   sd(_cons) |       2.76       0.74          1.63        4.67
        corr(conflict,_cons) |       1.00       0.00         -1.00        1.00
-----------------------------+------------------------------------------------
                sd(Residual) |      14.93       0.40         14.15       15.74
------------------------------------------------------------------------------

. 
. *Save random-effects for later use. Note that we're saving the predicted marginal intercept, not the model int
> ercept. 
. predict re1*, reffects
(353 missing values generated)
(353 missing values generated)

. gen slope_re1 = _b[1.conflict] + re11
(353 missing values generated)

. margins conflict, post

Predictive margins                              Number of obs     =      5,316
Model VCE    : Bootstrap

Expression   : Linear prediction, fixed portion, predict()

------------------------------------------------------------------------------
             |            Delta-method
             |     Margin   Std. Err.      z    P>|z|     [95% Conf. Interval]
-------------+----------------------------------------------------------------
    conflict |
          0  |       3.70       0.33    11.16   0.000         3.05        4.35
          1  |       1.74       0.43     4.01   0.000         0.89        2.58
------------------------------------------------------------------------------

. gen intercept_re1 = _b[0bn.conflict] + re12
(353 missing values generated)

. gen yhat_re1= intercept_re1 + (slope_re1*conflict)
(353 missing values generated)

. 
. *Save marginal predictions for later use.
. marginsplot, name(m2,replace) scheme(plotplain) plotopts(lcolor(black) lwidth(thin) mcolor(black) mlwidth(thin
> )) ciopts(lcolor(black) lwidth(medthin)) title("Model 2", size(medsmall) nospan) ylabel(0(1)5) yline(0 5, lpat
> tern(dot) lwidth(thin) lcolor(gs10)) ytitle("Budget Growth (%)") xtitle("Ideological Conflict (0,1)") graphreg
> ion(m(l=0)) plotregion(m(l=0 r=0)) xscale(ra(-0.15 1.15))

  Variables that uniquely identify margins: conflict

. 
. *Model 3.
. xtabond2 bgrowth l.bgrowth i.conflict academic political private public council board creator l.lni_budget y19
> 74-y2014, gmmstyle(l.bgrowth conflict academic political private public council board l.lni_budget, collapse l
> (1 4)) ivstyle(creator y1974-y2014, eq(level)) robust twostep orthogonal
Favoring space over speed. To switch, type or click on mata: mata set matafavor speed, perm.
0b.conflict dropped due to collinearity

Dynamic panel-data estimation, two-step system GMM
------------------------------------------------------------------------------
Group variable: agency_id                       Number of obs      =      4806
Time variable : year                            Number of groups   =       353
Number of instruments = 88                      Obs per group: min =         1
Wald chi2(51) =   1646.96                                      avg =     13.61
Prob > chi2   =     0.000                                      max =        42
------------------------------------------------------------------------------
             |              Corrected
     bgrowth |      Coef.   Std. Err.      z    P>|z|     [95% Conf. Interval]
-------------+----------------------------------------------------------------
     bgrowth |
         L1. |      -0.01       0.02    -0.28   0.776        -0.05        0.04
             |
  1.conflict |      -1.69       0.79    -2.13   0.033        -3.23       -0.14
    academic |       3.93       1.47     2.68   0.007         1.06        6.81
   political |      -0.77       1.13    -0.69   0.492        -2.98        1.43
     private |       2.16       1.48     1.46   0.144        -0.74        5.06
      public |       1.98       1.19     1.65   0.098        -0.37        4.32
     council |      -0.00       1.72    -0.00   1.000        -3.38        3.38
       board |       1.30       2.22     0.59   0.558        -3.05        5.66
     creator |       1.39       0.76     1.83   0.067        -0.10        2.89
             |
  lni_budget |
         L1. |       1.72       0.60     2.86   0.004         0.54        2.90
             |
       y1974 |     -11.61       2.85    -4.08   0.000       -17.19       -6.04
       y1975 |     -12.63       2.20    -5.74   0.000       -16.94       -8.32
       y1976 |     -11.93       2.72    -4.39   0.000       -17.26       -6.60
       y1977 |      -2.93       2.75    -1.07   0.287        -8.31        2.46
       y1978 |      -9.50       2.89    -3.28   0.001       -15.17       -3.82
       y1979 |      -5.98       2.78    -2.15   0.031       -11.43       -0.53
       y1980 |     -15.12       2.45    -6.18   0.000       -19.92      -10.33
       y1981 |      -9.39       2.83    -3.32   0.001       -14.94       -3.85
       y1982 |     -16.06       2.49    -6.44   0.000       -20.95      -11.18
       y1983 |     -13.24       2.57    -5.15   0.000       -18.27       -8.20
       y1984 |     -13.92       2.49    -5.58   0.000       -18.80       -9.03
       y1985 |     -14.88       2.43    -6.13   0.000       -19.64      -10.12
       y1986 |     -10.28       2.62    -3.93   0.000       -15.41       -5.16
       y1987 |     -10.49       2.61    -4.01   0.000       -15.61       -5.36
       y1988 |     -14.87       2.89    -5.15   0.000       -20.53       -9.21
       y1989 |      -9.54       2.60    -3.66   0.000       -14.65       -4.44
       y1990 |      -9.16       2.80    -3.28   0.001       -14.64       -3.68
       y1991 |     -13.77       2.59    -5.32   0.000       -18.84       -8.70
       y1992 |      -7.67       2.98    -2.58   0.010       -13.50       -1.83
       y1993 |     -13.79       3.08    -4.48   0.000       -19.82       -7.76
       y1994 |      -9.32       2.87    -3.24   0.001       -14.94       -3.69
       y1995 |      -4.21       2.76    -1.52   0.128        -9.62        1.21
       y1996 |      29.66       2.97     9.97   0.000        23.83       35.49
       y1997 |     -40.92       2.97   -13.76   0.000       -46.75      -35.09
       y1998 |     -13.14       3.06    -4.30   0.000       -19.14       -7.15
       y1999 |     -10.29       2.72    -3.79   0.000       -15.62       -4.97
       y2000 |     -16.35       2.81    -5.82   0.000       -21.86      -10.85
       y2001 |      -9.56       2.78    -3.44   0.001       -15.01       -4.11
       y2002 |     -11.22       2.69    -4.17   0.000       -16.50       -5.94
       y2003 |     -13.17       2.57    -5.12   0.000       -18.22       -8.13
       y2004 |     -14.25       2.49    -5.72   0.000       -19.13       -9.37
       y2005 |     -13.48       2.50    -5.39   0.000       -18.38       -8.58
       y2006 |     -11.94       2.54    -4.70   0.000       -16.92       -6.97
       y2007 |     -13.04       2.75    -4.74   0.000       -18.43       -7.65
       y2008 |     -17.59       2.88    -6.10   0.000       -23.24      -11.94
       y2009 |     -12.96       3.00    -4.32   0.000       -18.85       -7.08
       y2010 |     -11.39       2.78    -4.10   0.000       -16.84       -5.94
       y2011 |     -17.74       2.92    -6.08   0.000       -23.45      -12.02
       y2012 |     -13.41       2.86    -4.69   0.000       -19.01       -7.81
       y2013 |     -15.19       2.70    -5.62   0.000       -20.49       -9.89
       y2014 |     -14.41       2.71    -5.32   0.000       -19.72       -9.10
       _cons |     -19.76      10.73    -1.84   0.065       -40.79        1.27
------------------------------------------------------------------------------
Instruments for orthogonal deviations equation
  GMM-type (missing=0, separate instruments for each period unless collapsed)
    L(1/4).(L.bgrowth conflict academic political private public council board
    L.lni_budget) collapsed
Instruments for levels equation
  Standard
    creator y1974 y1975 y1976 y1977 y1978 y1979 y1980 y1981 y1982 y1983 y1984
    y1985 y1986 y1987 y1988 y1989 y1990 y1991 y1992 y1993 y1994 y1995 y1996
    y1997 y1998 y1999 y2000 y2001 y2002 y2003 y2004 y2005 y2006 y2007 y2008
    y2009 y2010 y2011 y2012 y2013 y2014
    _cons
  GMM-type (missing=0, separate instruments for each period unless collapsed)
    D.(L.bgrowth conflict academic political private public council board
    L.lni_budget) collapsed
------------------------------------------------------------------------------
Arellano-Bond test for AR(1) in first differences: z =  -9.40  Pr > z =  0.000
Arellano-Bond test for AR(2) in first differences: z =   0.39  Pr > z =  0.694
------------------------------------------------------------------------------
Sargan test of overid. restrictions: chi2(36)   =  72.31  Prob > chi2 =  0.000
  (Not robust, but not weakened by many instruments.)
Hansen test of overid. restrictions: chi2(36)   =  46.71  Prob > chi2 =  0.109
  (Robust, but weakened by many instruments.)

Difference-in-Hansen tests of exogeneity of instrument subsets:
  GMM instruments for levels
    Hansen test excluding group:     chi2(27)   =  35.77  Prob > chi2 =  0.120
    Difference (null H = exogenous): chi2(9)    =  10.93  Prob > chi2 =  0.280


. 
. *Generate marginal predictions.
. margins conflict
Warning: cannot perform check for estimable functions.

Predictive margins                              Number of obs     =      4,806
Model VCE    : Corrected

Expression   : Fitted Values, predict()

------------------------------------------------------------------------------
             |            Delta-method
             |     Margin   Std. Err.      z    P>|z|     [95% Conf. Interval]
-------------+----------------------------------------------------------------
    conflict |
          0  |       3.57       0.50     7.14   0.000         2.59        4.55
          1  |       1.88       0.74     2.55   0.011         0.44        3.33
------------------------------------------------------------------------------

. 
. *Save marginal predictions for later use.
. marginsplot, name(m3,replace) scheme(plotplain) plotopts(lcolor(black) lwidth(thin) mcolor(black) mlwidth(thin
> )) ciopts(lcolor(black) lwidth(medthin)) title("Model 3", size(medsmall) nospan) ylabel(0(1)5) yline(0 5, lpat
> tern(dot) lwidth(thin) lcolor(gs10)) ytitle("Budget Growth (%)") xtitle("Ideological Conflict (0,1)") graphreg
> ion(m(l=0)) plotregion(m(l=0 r=0)) xscale(ra(-0.15 1.15))

  Variables that uniquely identify margins: conflict

. 
. 
. //Figure 3. Predicted Marginal Budget Growth.
. 
. *Combine marginal predictions from Model 1, 2, and 3.
. gr combine m1 m2 m3, ycommon title("") scheme(plotplain) row(1) imargin(0 0 0 0) ysize(2) scale(2)

. 
. 
. //Figure 4. Predicted Agency-specific Budget Growth.
. 
. *To clean up the agency-specific graph, we only include agencies with actual variance on the treatment variabl
> e. This requires constructing measures that identify whether a given agency features both 0s and 1s on conflic
> t.
. sort agency_id conflict

. egen xmin=min(conflict), by(agency_id)

. egen xmax=max(conflict), by(agency_id)

. gsort -xmin -xmax agency_id conflict

. 
. *We also want to tag the marginal predictions for reference.
. gen margins_re1=3.70 if conflict==0
(2,147 missing values generated)

. replace margins_re1=1.74 if conflict==1
(2,147 real changes made)

. 
. *Graph the random-effects we saved above.
. twoway (connected yhat_re1 conflict if xmin==0 & xmax==1, connect(L) lwidth(thin) lpattern(solid) lcolor(gs12)
>  mstyle(none)) (connected margins_re1 conflict, sort lwidth(thin) lpattern(solid) lcolor(black) msymbol(circle
> _hollow) mlcolor(black) mlwidth(thin)) (connected yhat_re1 conflict if xmin==0 & xmax==1 & agency_id==9089, so
> rt lwidth(thin) lpattern(longdash) lcolor(black) msymbol(circle_hollow) mlcolor(black) mlwidth(thin)) (connect
> ed yhat_re1 conflict if xmin==0 & xmax==1 & agency_id==5002, sort lwidth(thin) lpattern(shortdash) lcolor(blac
> k) msymbol(circle_hollow) mlcolor(black) mlwidth(thin)), name(re1,replace) title("") ylabel(10(2)-6) yscale(ra
> nge(-6.5 10.5)) xscale(range(-0.15 1.15)) ytitle("Budget Growth (%)") xlabel(0 1) xtitle("Ideological Conflict
>  (0,1)") scheme(plotplain) legend(off) r2title(" " " " " ")  text(1.74 1 "  Average Marginal" " Effect", size(
> small) place(e)) text(7.6 1 "  Ethnic Discrimination" " Ombudsman", size(small) place(e)) text(-4.8 1 "  Swedi
> sh State" "  Railways", size(small) place(e)) aspect(1) xsize(6) ysize(5) graphregion(m(l=0 r=0)) plotr(m(zero
> ))

. 
. 
. 
. 
. log close
      name:  <unnamed>
       log:  -
  log type:  text
 closed on:  19 Aug 2021, 03:57:26
----------------------------------------------------------------------------------------------------------------
